package com.zff.rental.entity.dict;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zff.rental.AppConstant;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;


/**
 * 只有key的字典
 *
 * @author HCY
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@IdClass(KeyValueDict.MId.class)
@Entity
@Table(name = AppConstant.TABLE_NAME_DICT_KEY_VALUE)
@TableName(AppConstant.TABLE_NAME_DICT_KEY_VALUE)
public class KeyValueDict {
    /**
     * 字典类型
     * 1:房型：一室、一室一厅
     * 2:经营区域：松岗、沙井
     */
    @Id
    @Column(nullable = false)
    private Integer type;

    /**
     * 字典key
     */
    @Id
    @Column(nullable = false, length = 64)
    private String dictKey;

    /**
     * 字典值
     */
    @Column()
    private String dictValue;

    /**
     * 序号
     */
    @Column()
    private Integer serialNumber;

    /**
     * Id
     */
    @EqualsAndHashCode
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class MId implements Serializable {
        /**
         * 字典类型
         * 1:房型：一室、一室一厅
         * 2:经营区域：松岗、沙井
         */
        private Integer type;
        /**
         * 字典key
         */
        private String dictKey;
    }
}
